<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/common/base.jsp"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	AreaDao dao = new AreaDao();
	String sql ="select * from t_area ";
	Object[]params={};
	List<Area> areaList = dao.queryOjects(sql, params);
	
 %>

<!DOCTYPE html>
<html lang="zh-cn">
<head>
<base href="<%=basePath%>">

<title>家庭档案列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">

<link rel="stylesheet" href="css/styles.css">
<link rel="stylesheet" href="css/admin.css">
<script src="js/jquery-1.4.4.min.js"></script>
<script src="js/admin.js"></script>

</head>

<body>
	<form name="searchForm" id="searchForm"
		action="<%=request.getContextPath()%>/system/FamilyServlet?m=select"
		method="post">
		<div class="panel admin-panel">
			<div class="panel-head">
				<strong class="icon-reorder">家庭档案信息列表</strong>
			</div>
			<div class="padding border-bottom">
				<ul class="search" style="padding-left:10px;">
					<li><a class="button border-main icon-plus-square-o"
						href="<%=path%>/system/FamilyServlet?m=input">新建家庭档案</a></li>

					<li><a class="button border-main icon-plus-square-o"
						href="<%=path%>/system/MemberServlet?m=list">查询参合农民档案</a></li>
					<!-- 
				</ul>
			</div>
			<div class="padding border-bottom">
				<ul class="search" style="padding-left:10px;"> -->
					<li style="padding-left:100px;">搜索:</li>
					<li><select id="area" class="input w50" name="areacode"
						id="areacode"
						style="width:150px; line-height:17px;display:inline-block">
							<%
							for(Area a : areaList){
						 %>
							<option value="<%=a.getAreacode()%>">
								<%
						  
						  for(int i=0;i<a.getGrade();i++){
							 if(i==0){
								 out.print("|-"); 
							 }else{
								 out.print("-");
							 }
							  
						  } %>
								<%=a.getAreaname() %></option>

							<%} %>

					</select> <input type="text" name="familycode" id="familycode" value=''
						placeholder="请输入搜索家庭编号" class="input"
						style="width:150px;line-height:17px;display:inline-block " /> <input
						type="text" name="housemaster" id="housemaster" value=''
						placeholder="请输入搜索户主姓名" class="input"
						style="width:150px; line-height:17px;display:inline-block" />
						<button type="submit" class="button border-main icon-search"
							style="width:100px"
							onclick="javascript:window.location.href='<%=request.getContextPath()%>/system/FamilyServlet'">搜索</button>
					</li>
				</ul>
			</div>
		</div>
<%		String areacode = request.getParameter("areacode");
		
		if (areacode == null ) {
				StringBuffer sb = new StringBuffer(1024);
				sb.append("1=1");
				List<Family> newsList = Family.getNewsList(sb.toString());
				request.setAttribute("newsList", newsList);
			}
			
 %>
	</form>
	<table class="table table-hover text-center">
		<thead>
			<tr>
				<th>县级编号</th>
				<th>乡镇编号</th>
				<th>村编号</th>
				<th>户内编号</th>
				<th>家庭编号</th>
				<th>户主姓名</th>
				<th>家庭人口数</th>
				<th>农业人口数</th>
				<th>家庭住址</th>
				<th>创建时间</th>
				<th>记录员</th>
				<th>户主属性</th>
				<th width="170">操作</th>
			</tr>
		</thead>

		<tbody>
			<c:forEach var="news" items="${newsList}" varStatus="status">
				<tr>
					<td>${news.xareacode}</td>
					<td>${news.zareacode}</td>
					<td>${news.careacode}</td>
					<td>${news.housecode}</td>
					<td>${news.familycode}</td>
					<td>${news.housemaster}</td>
					<td>${news.sumfamily}人</td>
					<td>${news.sumfarmer}人</td>
					<td>${news.address}</td>
					<td>${news.createtime}</td>
					<td>${news.registrar}</td>
					<td><center>
							<a
								href="<%=path%>/system/FamilyServlet?m=hzxx&familycode=${news.familycode }">.
								. .</a>
						</center></td>
					<td><div class="button-group">
							<a class="button border-main"
								href="<%=path%>/system/FamilyServlet?m=get&id=${news.familycode }"><span
								class="icon-edit"></span> 修改</a> <a class="button border-red"
								href="javascript:if(confirm('确认是否删除此信息？')) location='<%=path%>/system/FamilyServlet?m=del&id=${news.familycode }'"><span
								class="icon-trash-o"></span> 删除</a>
						</div></td>
				</tr>
				</tr>
			</c:forEach>
		</tbody>
		
	</table>
</body>
</html>
